package com.alibaba.citrus.ots.price.ability.functions.factory.activity.process;

import com.alibaba.citrus.common.Result;
import com.alibaba.citrus.ots.common.util.SpringContextUtil;
import com.alibaba.citrus.ots.price.ability.functions.entity.activity.ActivityTermEntity;
import com.alibaba.citrus.ots.price.ability.functions.entity.activity.ActivityTitleEntity;
import com.alibaba.citrus.ots.price.repository.ActivityQueryRepository;
import com.epoch.app.otspricecenter.dto.request.ActivityInfoRequest;
import com.epoch.app.otspricecenter.dto.request.ActivityItemInfo;
import com.epoch.app.otspricecenter.dto.request.ParticipateActivityInfoRequest;
import com.epoch.app.otspricecenter.dto.request.ParticipateActivityTermRequest;
import com.epoch.app.otspricecenter.dto.response.ActivityTermResponse;

import java.util.List;

/**
 * 活动项目表追加信息
 */
public abstract class ActivityProcess {


    /**
     * 补全活动项目信息
     * @param titleEntity 活动抬头实体zw
     * @param itemId 原品 ID
     * @return
     */
    public abstract List<ActivityTermEntity> addInfo(ActivityTitleEntity titleEntity, String itemId);

    /**
     * 活动类型描述
     * @return
     */
    public abstract String getActivityTypeDesc();

    /**
     * 处理赠品逻辑，对买赠和搭赠有用，对于特价和补货是没有用的。
     * @param activityTermEntity
     * @param request
     * @return
     */
    public abstract List<ActivityItemInfo> processGift(ActivityTermEntity activityTermEntity, ActivityInfoRequest request);

    /**
     * 处理特价，对特价类型的活动有用，对买赠和搭赠无用
     * @param activityTermEntity
     * @param request
     * @return
     */
    public abstract String processSpecialOfferPrice(ActivityTermEntity activityTermEntity, ActivityInfoRequest request);

    /**
     * 更新占用费用
     * @param activityTermEntity 活动项目实体
     * @param termRequest 参加活动请求
     * @return
     */
    public abstract Long calculatePreOccupyFee(ActivityTermEntity activityTermEntity, ParticipateActivityTermRequest termRequest);

    /**
     * 更新活动占用数量
     * @param termEntity
     * @param termRequest 参加活动请求
     * @return
     */
    public abstract Integer calculateOccupyQuantity(ActivityTermEntity termEntity, ParticipateActivityTermRequest termRequest);

    /**
     * 过滤 term ,赠品活动需要进行过滤。特价活动不需要进行过滤
     * @param termEntity termEntity
     * @param itemId 原品 ID
     * @return true: 过滤，false：不进行过滤
     */
    public abstract Boolean filterTermOfCreate(ActivityTermEntity termEntity, String itemId);

    /**
     * 校验参加活动的数据,特价/赠品
     * @param request
     * @param response
     * @return
     */
    public abstract Result<Boolean> checkParticipateActivityData(ParticipateActivityInfoRequest request, ActivityTermResponse response);

    /**
     * 校验预占数量
     * @param termEntity
     * @param termRequest
     * @param preOccupyQuantity
     * @return
     */
    public abstract Boolean checkPreOccupyQuantity(ActivityTermEntity termEntity, ParticipateActivityTermRequest termRequest, Integer preOccupyQuantity);

    /**
     * 校验预占费用
     * @param termEntity 活动项目实体
     * @param thisPreOccupyFee 本次预占费用
     * @return true： 占用成功 false：占用失败
     */
    public abstract Boolean checkPreOccupyFee(ActivityTermEntity termEntity, Long thisPreOccupyFee);
}
